package com.yun.zf.admin.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yun.zf.common.admin.dto.PerformanceDto;
import com.yun.zf.common.admin.model.order.PerformanceMo;
import com.yun.zf.common.app.domain.ZfPerformance;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 * 业绩分配表明细 Mapper 接口
 * </p>
 *
 * @author cj
 * @since 2021-04-07
 */
@Mapper
public interface ZfPerformanceMapper extends BaseMapper<ZfPerformance> {

    @Select("<script>" +
            "SELECT  pf.id,pf.role_name,pf.agent_name,pf.agent_no,pf.allocation_atio ,pf.per_amount,pf.dept_name from zf_performance pf WHERE pf.order_id=#{orderId} and pf.city_code=#{cityCode} and pf.province_code=#{provCode}" +
            "</script>")
    public List<PerformanceDto> getPerformances (Long provCode, Long cityCode, Long orderId);

    @Select("<script>" +
            "SELECT   pf.id,pf.role_type,pf.role_name,pf.agent_name,pf.agent_no ,pf.dept_id,pf.dept_name from zf_performance pf WHERE role_type!='W' and pf.order_id=#{orderId} and pf.city_code=#{cityCode} and pf.province_code=#{provCode}" +
            "</script>")
    public List<PerformanceMo> bringPerformances (Long provCode, Long cityCode, Long orderId);

}
